use std::str::FromStr;
pub fn time_info(time: &str) -> String {
    let mut out = String::new();
    let day=MDay::from_str(time).unwrap();
    let d=match day.m {
        1|2=>{
            (12-day.m) as u32*30+(13-day.m) as u32/2 +1
                +match day.y {
                y if y%4==0 && y%100!=0 || y%400==0=>29,
                _=>28
            }
                -day.d as u32
        }
        m if m<8=>{
            (13-day.m) as u32*30+(13-day.m) as u32/2 +1-day.d as u32
        }
        _=>{
            (13-day.m) as u32*30+(14-day.m as u32)/2-day.d as u32
        }
    };
    let mut w=0;
    if (d as i32)-(((35+day.y+(day.y)/4-(day.y)/100+(day.y)/400)%7) as i32) <=0 {
        w=1;
    }
    else{
        w+=match (34+day.y+(day.y-1)/4-(day.y-1)/100+(day.y-1)/400)%7{
            4|5|6=>{0}
            _=>{1}
        };
        w+=match day.y {
            y if y%4==0 && y%100!=0 || y%400==0=>(365-d as i32 +((34+day.y+(day.y-1)/4-(day.y-1)/100+(day.y-1)/400)%7)as i32) /7,
            _=>(364-d as i32 +((34+day.y+(day.y-1)/4-(day.y-1)/100+(day.y-1)/400)%7)as i32) /7
        };
    }
    let  c;
    if CHUNJIE[day.y as usize-2000].0>day.m as u32 {
        c=31-CHUNJIE[day.y as usize-2000].0+day.d as u32;
    }
    else if CHUNJIE[day.y as usize-2000].0==day.m as u32 && CHUNJIE[day.y as usize-2000].1>=day.d as u32 {
        c=CHUNJIE[day.y as usize-2000].1-day.d as u32;
    }
    else{
        c=d+match CHUNJIE[day.y as usize+1-2000].0 {
            1=>{CHUNJIE[day.y as usize+1-2000].1}
            2=>{31+CHUNJIE[day.y as usize+1-2000].1}
            _ => {0}
        }
    }
    out.push_str(&format!("{},{},{}",w,d,c-1));
    println!("{time} {:?}",out);
    out
}
#[derive(Debug, Clone, Copy)]
struct MDay {
    y:u32,
    m:u8,
    d:u8
}
impl FromStr for MDay{
    type Err = ();

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let mut sp =s.split('-');
        Ok(
            Self{
                y:sp.next().unwrap().parse().unwrap(),
                m:sp.next().unwrap().parse().unwrap(),
                d:sp.next().unwrap().parse().unwrap()
            })
    }
}
const CHUNJIE:[(u32,u32);101]=[
    (2, 5),   // 2000
    (1, 24),  // 2001
    (2, 12),  // 2002
    (2, 1),   // 2003
    (1, 22),  // 2004
    (2, 9),   // 2005
    (1, 29),  // 2006
    (2, 18),  // 2007
    (2, 7),   // 2008
    (1, 26),  // 2009
    (2, 14),  // 2010
    (2, 3),   // 2011
    (1, 23),  // 2012
    (2, 10),  // 2013
    (1, 31),  // 2014
    (2, 19),  // 2015
    (2, 8),   // 2016
    (1, 28),  // 2017
    (2, 16),  // 2018
    (2, 5),   // 2019
    (1, 25),  // 2020
    (2, 12),  // 2021
    (2, 1),   // 2022
    (1, 22),  // 2023
    (2, 10),  // 2024
    (1, 29),  // 2025
    (2, 17),  // 2026
    (2, 6),   // 2027
    (1, 26),  // 2028
    (2, 13),  // 2029
    (2, 3),   // 2030
    (1, 23),  // 2031
    (2, 11),  // 2032
    (1, 31),  // 2033
    (2, 19),  // 2034
    (2, 8),   // 2035
    (1, 28),  // 2036
    (2, 15),  // 2037
    (2, 4),   // 2038
    (1, 24),  // 2039
    (2, 12),  // 2040
    (2, 1),   // 2041
    (1, 22),  // 2042
    (2, 10),  // 2043
    (1, 30),  // 2044
    (2, 17),  // 2045
    (2, 6),   // 2046
    (1, 26),  // 2047
    (2, 14),  // 2048
    (2, 3),   // 2049
    (1, 23),  // 2050
    (2, 11),  // 2051
    (1, 31),  // 2052
    (2, 19),  // 2053
    (2, 8),   // 2054
    (1, 28),  // 2055
    (2, 15),  // 2056
    (2, 5),   // 2057
    (1, 25),  // 2058
    (2, 12),  // 2059
    (2, 1),   // 2060
    (1, 21),  // 2061
    (2, 9),   // 2062
    (1, 29),  // 2063
    (2, 17),  // 2064
    (2, 6),   // 2065
    (1, 26),  // 2066
    (2, 14),  // 2067
    (2, 3),   // 2068
    (1, 23),  // 2069
    (2, 11),  // 2070
    (2, 1),   // 2071
    (1, 21),  // 2072
    (2, 9),   // 2073
    (1, 29),  // 2074
    (2, 17),  // 2075
    (2, 6),   // 2076
    (1, 26),  // 2077
    (2, 13),  // 2078
    (2, 2),   // 2079
    (1, 22),  // 2080
    (2, 10),  // 2081
    (1, 30),  // 2082
    (2, 18),  // 2083
    (2, 7),   // 2084
    (1, 27),  // 2085
    (2, 15),  // 2086
    (2, 5),   // 2087
    (1, 25),  // 2088
    (2, 12),  // 2089
    (2, 1),   // 2090
    (1, 21),  // 2091
    (2, 9),   // 2092
    (1, 29),  // 2093
    (2, 17),  // 2094
    (2, 6),   // 2095
    (1, 26),  // 2096
    (2, 14),  // 2097
    (2, 3),   // 2098
    (1, 23),  // 2099
    (2, 11),  // 2100
];



